import Vue from 'vue';
import Vuex from 'vuex';


Vue.use(Vuex);

const store = new Vuex.Store({

	state: {
		requestLoading: "",
		address: "",
		currentPagePath: "",
		currentPageOption: "",
		classCurrent:0,//商品分类首页
		userInfo: uni.getStorageSync('userInfo'),
		userAddress:uni.getStorageSync('userAddress'),
		info:"",
		isBackTop:false
	},
	mutations: {
        SET_USERINFO(state, val){
			state.userInfo = val;
			uni.setStorageSync('userInfo', val)	
		},
	    SET_INFO(state, val){
			state.info = val
		},
		SET_LOCATION(state, val){
			state.userAddress = val
			uni.setStorageSync('userAddress', val)	
		},
		
		

	},
	actions: {
      
	},
	getters: {
          city: state => state.userAddress.result.ad_info.district || '选择地址',
		  
		  location:state => state.userAddress.result.location
	}
});

export default store;
